/*
 * @lc app=leetcode.cn id=1979 lang=typescript
 *
 * [1979] 找出数组的最大公约数
 */

// @lc code=start
function findGCD(nums: number[]): number {
    let max = Math.max(...nums);
    let min = Math.min(...nums);
    const e = (a: number, b: number): number => {
        return b === 0 ? a : e(b, a % b);
    };
    return e(max, min);
}
// @lc code=end
